﻿/*
=============================================================================
Author:魏宝辉通过CodeSmithe生成
CreatedTime:2013-2-25
Description:BSSAGENCYAREA三层结构数据访问层
=============================================================================
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using PWMIS.DataMap.Entity;
using FTchina.Models;//引入模型层
using PWMIS.DataProvider.Data;
namespace FTchina.DAL
{
	public static partial class BSSAGENCYAREAService
	{
        public static BSSAGENCYAREA  GetByAREA_CODE(string area_code,AdoHelper ado)
        {
         BSSAGENCYAREA bssagencyarea = new BSSAGENCYAREA();
       bssagencyarea.AREA_CODE=area_code;
        EntityQuery<BSSAGENCYAREA> query = new EntityQuery<BSSAGENCYAREA>(ado);
        if (query.ExistsEntity(bssagencyarea))
        {
            query.FillEntity(bssagencyarea);
            return bssagencyarea;
        }
        else
        {
            return null;
        }
        }
         public static int  DeleteByAREA_CODE(string area_code,AdoHelper ado)
        {
         BSSAGENCYAREA bssagencyarea = new BSSAGENCYAREA();
       bssagencyarea.AREA_CODE=area_code;
        EntityQuery<BSSAGENCYAREA> query = new EntityQuery<BSSAGENCYAREA>(ado);
         
        return query.Delete(bssagencyarea);
        }
		 public static int AddOrUpdate(BSSAGENCYAREA bssagencyarea,AdoHelper ado)
        { 
        EntityQuery<BSSAGENCYAREA> query = new EntityQuery<BSSAGENCYAREA>(ado);
         int i=(query.ExistsEntity(bssagencyarea))?query.Update(bssagencyarea):query.Insert(bssagencyarea);
          return i;
        }
	}
}

